// pages/new/new.js
import util from "../../../utils/util.js"
import {
    areaList
} from './area-data';
Page({

    /**
     * 页面的初始数据
     */
    data: {
        citynow: 0,
        //这个规定从0开始
        areanow: 0,
        timenow: 1,
        need: [
            // {
            //     name: "高中数学老师",
            //     num: 15
            // },
            // {
            //     name: "小学物理老师",
            //     num: 5
            // },
        ],
        loac: 0,
        infmation: {
            Inaut: 0,
            outofaut: 0,
            unKown: 0
        },
        cities: [],
        areas: [],
        selectArray: [{
                "id": "0",
                "value": "本周"
            },
            {
                "id": "1",
                "value": "本月"
            },
            {
                "id": "2",
                "value": "本季度"
            },
            {
                "id": "3",
                "value": "本年"
            },
        ],
        imgUrls: [],
        // 'https://636c-cloud1-8ggeumhe5b48fafe-1307972625.tcb.qcloud.la/photo.png?sign=e17b9a817385f932d626af428ad97a97&t=1637143528',
        text: "教师节，听听习总书记怎么说",
        header: ['招教公告', '通知公示', '新闻资讯', '政策动态'],
        inf: [],
        publish: [],
        news: [],
        policy: [],
        state: ['即将报名', '正在报名', '结束报名'],
        hotItem: undefined,
        curPosition: {},
        gzhPost: [],
        navigationBarHeight: 0,
        showPositionCard: false,
        cityCode: 0
    },
    openPositionCard() {
        this.setData({
            showPositionCard: true
        })
    },
    closePositionCard() {
        this.setData({
            showPositionCard: false
        })
    },
    changePosition(e) {
        var provinceName = e.detail.values[0].name
        var cityName = e.detail.values[1].name
        console.log(cityName);

        this.setData({
            'curPosition.province': provinceName,
            'curPosition.city': cityName
        })
        //存储到全局变量中
        wx.setStorageSync('curPosition', {
            province: provinceName,
            city: cityName
        })
        // 更新热门岗位
        console.log('update');
        const pos = {
            province: this.data.curPosition.province,
            city: this.data.curPosition.city,
        }
        wx.cloud.callFunction({
            name: 'getPost',
            data: {
                Action: 'getHostPost',
                ...pos
            },
            success: r => {
                const publishDate = new Date(r.result.data.release_time)
                r.result.data.publishTime = `${publishDate.getFullYear()}年${publishDate.getMonth()+1}月${publishDate.getDate()}日`
                this.setData({
                    hotItem: r.result.data
                })
            }
        })
        this.closePositionCard()
    },
    toGzhPost(e) {
        wx.navigateTo({
            url: '../../pages/gzdWebView/gzhWebView?path=' + util.baseEncode(e.currentTarget.dataset.link),
        })
    },
    go_detail(e) {
        let k = e.currentTarget.dataset.index;
        console.log(this.data.inf[k]._id)
        wx.navigateTo({
            url: '../../pages/publishList_detail/1?_id=' + this.data.inf[k]._id,
        })
    },
    go_notice_detail(e) {
        let k = e.currentTarget.dataset.index;
        console.log(this.data.publish[k]._id)
        wx.navigateTo({
            url: '../../pages/Notice_detail/Notice_detail?_id=' + this.data.publish[k]._id,
        })
    },
    go_member() {
        // wx.navigateTo({
        //   url: '../../pages/huiyuan/huiyuan?openid='+getApp().globalData.openId,
        // })
        wx.navigateTo({
            url: '../../pages/function-introduction/function-introduction',
        })
    },
    go_news_detail(e) {
        let k = e.currentTarget.dataset.index;
        console.log(this.data.news[k]._id)
        wx.navigateTo({
            url: '../../pages/news_detail/news_detail?_id=' + this.data.news[k]._id,
        })
    },
    go_policy_detail(e) {
        let k = e.currentTarget.dataset.index;
        wx.navigateTo({
            url: '../../pages/policy_detail/policy_detail?_id=' + this.data.policy[k]._id,
        })
    },
    go_to_job_list() {
        wx.switchTab({
            url: '../../pages/job-offering/job-offering',
        })
    },
    go_book_store() {
        wx.navigateToMiniProgram({
            appId: 'wx5d740ab5ffa6760a',
        })
    },
    go_shequn() {
        wx.navigateTo({
            url: '../../pages/shequn2/shequn2',
        })
    },
    go_to_online_question() {
        wx.navigateTo({
            url: '../../pages/online_question/online_question',
        })
    },
    go_to_experience() {
        wx.navigateTo({
            url: '../../pages/interview_experience_origin/interview_experience_origin',
        })
    },
    async go_function() {
        // let temp=await wx.cloud.callFunction({
        //     name: "inviteUser",
        //     data: {
        //         sign: 4,
        //         openid: getApp().globalData.openId
        //     }
        // })
        // temp=temp.result
        // if(temp.errCode==1||temp.vip==false){
        //     wx.showToast({
        //       title: '请开通会员查看!',
        //       icon: 'error',
        //       duration: 2000,
        //       success:res =>{
        //         setTimeout(function(){
        //             wx.navigateTo({
        //                 url: '../../pages/huiyuan/huiyuan',
        //               })
        //         },2000)
        //       }
        //     })   
        //     console.log("=============tiaozhuan==============")
        //     return ;
        // }       
        wx.navigateTo({
            url: '../../pages/subcribe/subcribe',
        })
    },
    JumpToMoreNews(e) {
        const targetPageType = e.currentTarget.dataset.type;
        if (getApp().globalData.isLogin == undefined) {
            wx.cloud.callFunction({
                name: "inviteUser",
                data: {
                    sign: 5
                },
                success: res => {
                    //如果该用户未登陆过
                    if (res.result.length == 0) {
                        wx.showToast({
                            title: '请先登录',
                            icon: "error",
                            duration: 1000
                        })
                        setTimeout(function () {
                            wx.navigateTo({
                                url: "/pages/login_main/login_main",
                                success: (result) => {

                                },
                                fail: () => {},
                                complete: () => {}
                            });
                        }, 1000)
                    } else {
                        getApp().globalData.isLogin = true
                        wx.navigateTo({
                            url: '/pages/new/more-news/more-news?type=' + targetPageType,
                        })
                    }
                }
            })
        } else {
            wx.navigateTo({
                url: '/pages/new/more-news/more-news?type=' + targetPageType,
            })
        }

    },
    next() {
        let c = this.data.citynow + 1;
        if (c >= this.data.cities.length) {
            c = 0;
        }
        this.setData({
            citynow: c,
        });
    },
    timechange(e) {
        this.setData({
            timenow: 3 - e.detail.id,
        });
        console.log(e.detail.id);
        let t = this.data.timenow;
        let ci = this.data.cities[this.data.citynow] + "市";
        let d = this.data.areas[this.data.areanow]
        wx.cloud.callFunction({
            name: 'getIndexInfo',
            data: {
                sign: 6,
                flag: t,
                city: ci,
                district: d
            },
            success: res => {
                console.log(res.result.count);
                let c = res.result.count;
                this.setData({
                    publishcount: c
                })

            }

        })
        let b = 7
        if (this.data.timenow == 0) {
            b = 360;
        }
        if (this.data.timenow == 1) {
            b = 90;
        }
        if (this.data.timenow == 2) {
            b = 30;
        }
        if (this.data.timenow == 3) {
            b = 7;
        }
        wx.cloud.callFunction({
            name: 'return-recruit-info',
            data: {
                action: "show",
                choosetime: b,
                city: ci,
                district: d,

            },
            success: res => {
                console.log(".............")
                console.log(res.result);
                let a = res.result.authorized;
                let h = res.result.needs;
                let r = res.result.newadd;
                let g = {};
                let n = [];
                let m = {};
                let s = 0;
                g.unKown = 0;
                g.Inaut = 0;
                g.outofaut = 0;
                //_id使用数字标识，0是编制内，1是编制外，2是未知
                for (let i = 0; i < a.length; i++) {
                    if (a[i]._id == 2) {
                        g.unKown = a[i].total;
                    }
                    if (a[i]._id == 1) {
                        g.outofaut = a[i].total;
                    }
                    if (a[i]._id == 0) {
                        g.Inaut = a[i].total;
                    }
                }
                for (let i = 0; i < h.length; i++) {
                    m.name = h[i]._id;
                    m.num = h[i].count;
                    n.push(m);
                    m = {};
                }
                if (r.length != 0) {
                    s = r[0].total;
                }
                this.setData({
                    infmation: g,
                    loac: s,
                    need: n
                })

            }

        })
    },
    async cityChange(e) {
        this.setData({
            citynow: e.detail.index,
        });
        let m = this.data.cities[this.data.citynow]
        await wx.cloud.callFunction({
            name: 'getCityInf',
            data: {
                action: "getAreas",
                cityName: m
            }
        }).then(res => {
            let g = res.result.data[0].area;
            this.setData({
                areas: g,
                // areanow:0,
            })
        })
        let t = this.data.timenow;
        let ci = this.data.cities[this.data.citynow] + "市";
        let d = this.data.areas[this.data.areanow];
        await wx.cloud.callFunction({
            name: 'getIndexInfo',
            data: {
                sign: 6,
                flag: t,
                city: ci,
                district: d
            },
            success: res => {
                console.log(res.result.count);
                let c = res.result.count;
                this.setData({
                    publishcount: c
                })

            }

        })
        let b = 7
        if (this.data.timenow == 0) {
            b = 360;
        }
        if (this.data.timenow == 1) {
            b = 90;
        }
        if (this.data.timenow == 2) {
            b = 30;
        }
        if (this.data.timenow == 3) {
            b = 7;
        }
        console.log(ci);
        console.log(d)
        await wx.cloud.callFunction({
            name: 'return-recruit-info',
            data: {
                action: "show",
                choosetime: 360,
                city: ci,
                district: d,

            },
            success: res => {
                console.log(res.result);
                let a = res.result.authorized;
                let h = res.result.needs;
                let r = res.result.newadd;
                let g = {};
                let n = [];
                let m = {};
                let s = 0;
                g.unKown = 0;
                g.Inaut = 0;
                g.outofaut = 0;
                //_id使用数字标识，0是编制内，1是编制外，2是未知
                for (let i = 0; i < a.length; i++) {
                    if (a[i]._id == 2) {
                        g.unKown = a[i].total;
                    }
                    if (a[i]._id == 1) {
                        g.outofaut = a[i].total;
                    }
                    if (a[i]._id == 0) {
                        g.Inaut = a[i].total;
                    }
                }
                for (let i = 0; i < h.length; i++) {
                    m.name = h[i]._id;
                    m.num = h[i].count;
                    n.push(m);
                    m = {};
                }
                if (r.length != 0) {
                    s = r[0].total;
                }
                this.setData({
                    infmation: g,
                    loac: s,
                    need: n
                })

            }

        })
    },
    getCurrentIndex(e) {
        // console.log(e.detail);
        this.setData({
            areanow: e.detail
        });
        let t = this.data.timenow;
        let ci = this.data.cities[this.data.citynow] + "市";
        let d = this.data.areas[this.data.areanow]
        wx.cloud.callFunction({
            name: 'getIndexInfo',
            data: {
                sign: 6,
                flag: t,
                city: ci,
                district: d
            },
            success: res => {
                // console.log(res.result.count);
                let c = res.result.count;
                this.setData({
                    publishcount: c
                })

            }

        })
        let b = 7
        if (this.data.timenow == 0) {
            b = 360;
        }
        if (this.data.timenow == 1) {
            b = 90;
        }
        if (this.data.timenow == 2) {
            b = 30;
        }
        if (this.data.timenow == 3) {
            b = 7;
        }
        wx.cloud.callFunction({
            name: 'return-recruit-info',
            data: {
                action: "show",
                choosetime: b,
                city: ci,
                district: d,

            },
            success: res => {
                //console.log(res.result);
                let a = res.result.authorized;
                let h = res.result.needs;
                let r = res.result.newadd;
                let g = {};
                let n = [];
                let m = {};
                let s = 0;
                g.unKown = 0;
                g.Inaut = 0;
                g.outofaut = 0;
                for (let i = 0; i < a.length; i++) {
                    if (a[i]._id == 2) {
                        g.unKown = a[i].total;
                    }
                    if (a[i]._id == 1) {
                        g.outofaut = a[i].total;
                    }
                    if (a[i]._id == 0) {
                        g.Inaut = a[i].total;
                    }
                }
                for (let i = 0; i < h.length; i++) {
                    m.name = h[i]._id;
                    m.num = h[i].count;
                    n.push(m);
                    m = {};
                }
                if (r.length != 0) {
                    s = r[0].total;
                }
                this.setData({
                    infmation: g,
                    loac: s,
                    need: n
                })

            }

        })
    },
    areaChange(e) {
        // console.log(this.data.areanow)
    },
    go_to_online_question() {
        wx.navigateTo({
            url: '../../pages/online_question/online_question',
        })
    },
    goToHotPosition() {
        wx.navigateTo({
            url: '/pages/detail/detail?id=' + this.data.hotItem._id,
        })
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: async function (options) {
        this.setData({
            areaList
        })
        //计算navigationBar高度
        {
            // 获取系统信息
            const systemInfo = wx.getSystemInfoSync();
            // 胶囊按钮位置信息
            const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
            this.setData({
                navigationBarHeight: (menuButtonInfo.top - systemInfo.statusBarHeight) * 2 + menuButtonInfo.height + systemInfo.statusBarHeight
            })
        }
        //判断登录情况
        {
            wx.cloud.callFunction({
                name: 'getGZH',
                data: {
                    Action: 'getList',
                    skip: 0,
                    size: 3,
                },
                success: r => {
                    this.setData({
                        gzhPost: r.result.data
                    })
                }
            })
        } {
            let that = this
            // 请求热门岗位信息
            wx.getLocation({
                success(r) {
                    wx.request({
                        url: 'https://apis.map.qq.com/ws/geocoder/v1',
                        data: {
                            location: '' + r.latitude + ',' + r.longitude,
                            key: '3F3BZ-2MT6X-SBG4O-7ZUFM-E6PAO-OXB3Q'
                        },
                        success(res) {
                            if (res.data.status != 0) {
                                wx.showToast({
                                    title: '定位失败',
                                    icon: "error"
                                })
                            } else {
                                for (let i = 0; i < Object.values(areaList.city_list).length; i++) {
                                    if (Object.values(areaList.city_list)[i] == res.data.result.address_component.city)
                                        that.setData({
                                            cityCode: Object.keys(areaList.city_list)[i]
                                        })
                                }
                                const pos = {
                                    province: res.data.result.address_component.province,
                                    city: res.data.result.address_component.city,
                                }
                                that.setData({
                                    curPosition: pos
                                })
                                wx.cloud.callFunction({
                                    name: 'getPost',
                                    data: {
                                        Action: 'getHostPost',
                                        ...pos
                                    },
                                    success(r) {
                                        const publishDate = new Date(r.result.data.release_time)
                                        r.result.data.publishTime = `${publishDate.getFullYear()}年${publishDate.getMonth()+1}月${publishDate.getDate()}日`
                                        that.setData({
                                            hotItem: r.result.data
                                        })
                                    }
                                })
                            }
                        }
                    })
                },
                fail(r) {
                    // 获取位置失败使用默认位置
                    const pos = {
                        province: '广东省',
                        city: '广州市',
                    }
                    that.setData({
                        curPosition: pos
                    })
                    wx.cloud.callFunction({
                        name: 'getPost',
                        data: {
                            Action: 'getHostPost',
                            ...pos
                        },
                        success(r) {
                            const publishDate = new Date(r.result.data.release_time)
                            r.result.data.publishTime = `${publishDate.getFullYear()}年${publishDate.getMonth()+1}月${publishDate.getDate()}日`
                            that.setData({
                                hotItem: r.result.data
                            })
                        }
                    })
                }
            })
        }
        wx.cloud.callFunction({
                name: 'get_lunbo',
            }).then(res => {
                let ans = res.result.data;
                let s = []
                for (let i = 0; i < ans.length; i++) {
                    s.push(ans[i]);
                }
                console.log("lunbo:--------", s)
                this.setData({
                    imgUrls: s
                })
            }),
            //引入招教公告信息
            wx.cloud.callFunction({
                name: 'getIndexInfo',
                data: {
                    sign: 0
                }
            }).then(res => {
                let ans = res.result.data;
                let k = {};
                let end = [];
                for (let i = 0; i < ans.length; i++) {
                    k.tit = ans[i].title;
                    k.begintime = util.formatTime(new Date(ans[i].StartTime));
                    k.endtime = util.formatTime(new Date(ans[i].EndTime));
                    k.unit = ans[i].apart;
                    k.publishtime = util.formatTime(new Date(ans[i].date));
                    k.state = ans[i].status;
                    k._id = ans[i]._id;
                    end.push(k);
                    k = {};
                }
                this.setData({
                    inf: end
                })
            }),
            //通知公示数据载入
            wx.cloud.callFunction({
                name: 'getIndexInfo',
                data: {
                    sign: 1
                }
            }).then(res => {
                let ans = res.result.data;
                console.log(ans);
                let k = {};
                let end = [];
                for (let i = 0; i < ans.length; i++) {
                    k.tit = ans[i].title;
                    k.publishtime = util.formatTime(new Date(ans[i].date));
                    k.unit = ans[i].apart;
                    k._id = ans[i]._id;
                    end.push(k);
                    k = {};
                }
                this.setData({
                    publish: end
                })
            }),
            //通知公示数据载入
            wx.cloud.callFunction({
                name: 'getIndexInfo',
                data: {
                    sign: 2
                }
            }).then(res => {
                let ans = res.result.data;
                let k = {};
                let end = [];
                for (let i = 0; i < ans.length; i++) {
                    k.tit = ans[i].title;
                    k.time = util.formatTime(new Date(ans[i].date));
                    k.imageurl = ans[i].picture;
                    k.unit = ans[i].apart;
                    k._id = ans[i]._id;
                    end.push(k);
                    k = {};
                }
                this.setData({
                    news: end
                })
            }),
            //政策动态数据载入
            wx.cloud.callFunction({
                name: 'getIndexInfo',
                data: {
                    sign: 3
                }
            }).then(res => {
                let ans = res.result.data;
                let k = {};
                let end = [];
                for (let i = 0; i < ans.length; i++) {
                    k.tit = ans[i].title;
                    k.time = util.formatTime(new Date(ans[i].date));
                    k.imageurl = ans[i].picture;
                    k.unit = ans[i].apart;
                    k._id = ans[i]._id;
                    end.push(k);
                    k = {};
                }
                this.setData({
                    policy: end
                })
            }),
            //城市引入
            await wx.cloud.callFunction({
                name: 'getCityInf',
                data: {
                    action: "getCities",
                    limit: 100
                },
            }).then(res => {
                let ans = res.result.data;
                let k = [];
                for (let i = 0; i < ans.length; i++) {
                    if (ans[i].city != null) {
                        k.push(ans[i].city)
                    } else {
                        break;
                    }
                }
                this.setData({
                    cities: k,
                })
            })
        let k1 = this.data.cities;
        //区域引入
        if (k1.length != 0) {
            await wx.cloud.callFunction({
                name: 'getCityInf',
                data: {
                    action: "getAreas",
                    cityName: k1[0]
                }
            }).then(res => {
                let g = res.result.data[0].area;
                this.setData({
                    areas: g
                })
            })
        }
        let city = this.data.cities[0] + "市";
        let area = this.data.areas[0];
        //招教公告数量更新初始化
        await wx.cloud.callFunction({
            name: 'getIndexInfo',
            data: {
                sign: 6,
                flag: 3,
                city: city,
                district: area
            },
            success: res => {
                let c = res.result.count;
                this.setData({
                    publishcount: c
                })

            }

        })
        let b = 7
        if (this.data.timenow == 0) {
            b = 360;
        }
        if (this.data.timenow == 1) {
            b = 90;
        }
        if (this.data.timenow == 2) {
            b = 30;
        }
        if (this.data.timenow == 3) {
            b = 7;
        }
        await wx.cloud.callFunction({
            name: 'return-recruit-info',
            data: {
                action: "show",
                choosetime: b,
                city: city,
                district: area,

            },
            success: res => {
                console.log(res.result);
                let a = res.result.authorized;
                let h = res.result.needs;
                let r = res.result.newadd;
                let g = {};
                let n = [];
                let m = {};
                let s = 0;
                g.unKown = 0;
                g.Inaut = 0;
                g.outofaut = 0;
                for (let i = 0; i < a.length; i++) {
                    if (a[i]._id == 2) {
                        g.unKown = a[i].total;
                    }
                    if (a[i]._id == 1) {
                        g.outofaut = a[i].total;
                    }
                    if (a[i]._id == 0) {
                        g.Inaut = a[i].total;
                    }
                }
                for (let i = 0; i < h.length; i++) {
                    m.name = h[i]._id;
                    m.num = h[i].count;
                    n.push(m);
                    m = {};
                }
                if (r.length != 0) {
                    s = r[0].total;
                }
                this.setData({
                    infmation: g,
                    loac: s,
                    need: n
                })

            }

        })

    },
    goDetail(e) {
        var link = e.currentTarget.dataset.link;
        var type = e.currentTarget.dataset.type;
        console.log("link:-------", link)
        console.log("type:------", type)
        wx.setStorageSync('link', link)
        //如果是功能页面
        if (type == "function") {
            wx.navigateTo({
                url: '../../pages/function-introduction/function-introduction',
            })
        } else if (type == "gzh") {
            console.log("gzh----------------------------------")
            console.log("link", link)
            e.currentTarget.dataset.link = link
            this.toGzhPost(e)
        } else {
            //查找对应的_id
            wx.cloud.callFunction({
                name: "getIndexInfo",
                data: {
                    sign: 27,
                    type: type,
                    link: link
                }
            }, ).then(res => {
                console.log("res:", res.result.data)
                let temp = res.result.data[0]
                if (!temp) {
                    wx.showToast({
                        title: '该公告未录入,敬请期待',
                        icon: 'none',
                        duration: 2000,
                    })
                } else {
                    var id = temp._id
                    console.log("id------------:", id)
                    //找到对应类型公告
                    if (type == "notice") {
                        wx.navigateTo({
                            url: '../../pages/Notice_detail/Notice_detail?_id=' + id,
                        })
                    } else if (type == "news") {
                        wx.navigateTo({
                            url: '../../pages/news_detail/news_detail?_id=' + id,
                        })
                    } else if (type == "policy") {
                        wx.navigateTo({
                            url: '../../pages/policy_detail/policy_detail?_id=' + id,
                        })
                    } else if (type == "employ_notice") {
                        wx.navigateTo({
                            url: '../../pages/publishList_detail/1?_id=' + id,
                        })
                    }
                }
            })
        }
    },
    // goDetail(e){
    //     var link=e.currentTarget.dataset.link;
    //     var type=e.currentTarget.dataset.type;
    //     console.log("link:-------",link)
    //     console.log("type:------",type)
    //     wx.setStorageSync('link', link)
    //     //查找对应的_id
    //     wx.cloud.callFunction({
    //           name:"getIndexInfo",
    //           data:{
    //             sign: 27,
    //             type: type,
    //             link: link
    //           }
    //         }, ).then(res => {
    //         console.log("res:",res.result.data)
    //         let temp = res.result.data[0]
    //             if (!temp) {
    //           wx.showToast({
    //             title: '该公告未录入,敬请期待',
    //             icon:'none',
    //             duration:2000,
    //           })
    //         }else{
    //             var id=temp._id
    //             console.log("id------------:",id)
    //             //找到对应类型公告
    //             if(type=="notice"){
    //                 wx.navigateTo({
    //                     url: '../../pages/Notice_detail/Notice_detail?_id=' + id,
    //                 })
    //             }else if(type=="news"){
    //                 wx.navigateTo({
    //                     url: '../../pages/news_detail/news_detail?_id=' + id,
    //                 })
    //             }else if(type=="policy"){
    //                 wx.navigateTo({
    //                     url: '../../pages/policy_detail/policy_detail?_id=' + id,
    //                 })
    //             }else if(type=="employ_notice"){
    //                 wx.navigateTo({
    //                     url: '../../pages/publishList_detail/1?_id=' + id,
    //                 })
    //             }
    //         }
    //     })

    // },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {
        /*
        if(getApp().globalData.isLogin==undefined){
        wx.cloud.callFunction({
            name: "inviteUser",
            data: {
              sign: 5
            },
            success: res=>{
              //如果该用户未登陆过
          if(res.result.length==0){
            wx.navigateTo({
              url: "/pages/login_main/login_main",
              success: (result) => {
    
              },
              fail: () => {},
              complete: () => {}
          });
          }else{
              getApp().globalData.isLogin=true
          }
            }
          })
        }
        */
    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    },
    go_more_posts() {
        const that = this
        var province = this.data.curPosition.province
        var city = this.data.curPosition.city
        if (province == undefined) {
            province = "广东省"
        }
        if (city == undefined) {
            city = "广州市"
        }
        console.log("url:", '../../pages/more_posts/more_posts?province=' + province + "&city=" + city)
        wx.navigateTo({
            url: '../../pages/more_posts/more_posts?province=' + province + "&city=" + city,
        })
    }
})